﻿using Antlr4.Runtime;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Qsettings. Demo
{
    class Program
    {

        private static void Main(string[] args)
        {
            Console.WriteLine(typeof(System.Linq.Expressions.Expression<>).AssemblyQualifiedName);

            var type = Type.GetType(@"System.Linq.Expressions.Expression+BinaryExpressionProxy, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
            Console.WriteLine(type);
            (new Program()).Run();
        }
        public void Run()
        {

            try
            {
                Console.WriteLine("START");
                RunParser();
                Console.Write("DONE. ");
            }
            catch (Exception ex)
            {
                Console.WriteLine("ERROR: " + ex);
            }
            Console.Read();
        }
        private void RunParser()
        {
            AntlrInputStream inputStream = new AntlrInputStream(@"package world.some;
import seecool.wtf;
import wtf as seecool.wtf1;
assembly wtf.aaa.sdfsdf, Version=1.1.1.11, PublicKey=123456, Culture=zh-CN, ProcessorArchitecture=msil;
");
            var lexer = new QmanifestLexer(inputStream);
            CommonTokenStream commonTokenStream = new CommonTokenStream(lexer);
            var parser = new QmanifestParser(commonTokenStream);
            QmanifestParser.CompileUnitContext context = parser.compileUnit();

            Console.WriteLine(context.ToStringTree());
        }
    }
}
